type batterysecret, domain;
type batterysecret_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(batterysecret)

r_dir_file(batterysecret, cgroup)
r_dir_file(batterysecret, mnt_vendor_file)
r_dir_file(batterysecret, vendor_sysfs_battery_supply)
r_dir_file(batterysecret, sysfs_batteryinfo)
r_dir_file(batterysecret, sysfs_type)
r_dir_file(batterysecret, vendor_sysfs_usb_supply)
r_dir_file(batterysecret, vendor_sysfs_usbpd_device)

allow batterysecret {
  mnt_vendor_file
  rootfs
}:dir rw_dir_perms;

allow batterysecret {
  sysfs
  vendor_sysfs_battery_supply
  sysfs_usb
  vendor_sysfs_usb_supply
  vendor_sysfs_usbpd_device
}:file w_file_perms;

allow batterysecret kmsg_device:chr_file rw_file_perms;

allow batterysecret self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;

allow batterysecret self:global_capability_class_set {
  sys_tty_config
  sys_boot
};

allow batterysecret self:capability {
  chown
  fsetid
};

allow batterysecret {
  system_suspend_hwservice
  hidl_manager_hwservice
}:hwservice_manager find;

binder_call(batterysecret, system_suspend_server)

wakelock_use(batterysecret)

allow batterysecret rootfs:dir write;
allow batterysecret self:netlink_kobject_uevent_socket { bind create read setopt };
allow batterysecret self:capability2 block_suspend;
allow batterysecret self:cap2_userns block_suspend;
allow batterysecret sysfs_wake_lock:file rw_file_perms;
allow batterysecret vendor_sysfs_battery_supply:dir r_dir_perms;
allow batterysecret vendor_sysfs_qcom_battery:file rw_file_perms;
allow batterysecret vendor_sysfs_qcom_battery:file write;
allow batterysecret vendor_sysfs_qcom_battery:file { open read write };
allow batterysecret vendor_sysfs_qcom_battery:dir r_dir_perms;
allow batterysecret system_suspend_server:binder { call transfer };
allow batterysecret system_suspend_server:fd *;
allow batterysecret sysfs_batteryinfo:file r_file_perms;
r_dir_file(batterysecret, rootfs)
get_prop(batterysecret, hwservicemanager_prop)
get_prop(batterysecret, vendor_default_prop)
set_prop(batterysecret, vendor_system_prop)
hwbinder_use(batterysecret)
